﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp7
{
    public enum Fist
    {
        石头=1,
        剪刀=2,
        布=3
    }
    public enum Man
    {
        刘备 = 1,
        孙权 = 2,
        曹操 = 3
    }
    class Program
    {
       static string name;
        public static int a;
        static string name1;
        static int ping = 0;
        static int ying = 0;
        static int shu = 0;
        static int ci = 0;
       
        static void Main(string[] args)
        {
            
            Console.WriteLine("---------------------欢迎进入游戏世界--------------------------");
            Console.WriteLine();
            Console.WriteLine("*********************************");
            Console.WriteLine("************猜拳 开始************");
            Console.WriteLine("*********************************");
            kaishi();


        }
       static public void kaishi()
        {
            Console.WriteLine("出拳规则：1、石头 2、剪刀 3、布");
            Console.WriteLine("请选择对方角色： 1、刘备 2、孙权 3、曹操");
            int key = int.Parse(Console.ReadLine());
            Console.WriteLine("请输入您的姓名：");
            name1 = Console.ReadLine();
            Myself my = new Myself(name1);
            switch (key)
            {
                case 1:
                    name = "刘备";
                    Console.WriteLine(name1 + "vs" + name + "对战");
                    Console.WriteLine("开始游戏吗");
                    Console.WriteLine("请选择1、开始游戏 2、退出");
                    Panduan();

                    break;
                case 2:
                    name = "孙权";
                    Console.WriteLine(name1 + "vs" + name + "对战");
                    Console.WriteLine("开始游戏吗");
                    Console.WriteLine("请选择1、开始游戏 2、退出");
                    Panduan();
                    break;
                case 3:
                    name = "曹操";
                    Console.WriteLine(name1 + "vs" + name + "对战");
                    Console.WriteLine("开始游戏吗");
                    Console.WriteLine("请选择1、开始游戏 2、退出");
                    Panduan();
                    break;
                default:
                    break;
            }
        }
        static public void Panduan()
        {

          
            int key1 = int.Parse(Console.ReadLine());
            switch (key1)
            {
                case 1:
                    Fist stou = Fist.石头;
                    int num = 1;
                    Fist f = (Fist)num;
                    Fist jiandao = Fist.剪刀;
                    int num1 = 2;
                    Fist f1 = (Fist)num1;
                    Fist bu = Fist.布;
                    int num2 = 3;
                    Fist f2 = (Fist)num2;
                    Console.WriteLine("请出拳：{0}", ListFist());

                    int key2 = int.Parse(Console.ReadLine());
                    if (key2 == 1)
                    {
                        Console.WriteLine(name1 + ":" + "出拳：" + f);
                        ListFist();
                        Liubei liu = new Liubei(name);
                        Random ra = new Random();
                        int a = ra.Next(3) + 1;
                        Fist fist = (Fist)a;
                        Console.WriteLine(name + "：出拳：" + fist);


                        if (a == 1)
                        {
                            Console.WriteLine("平局");
                            ping = ping + 1;
                        }
                        else if (a == 2)
                        {
                            Console.WriteLine(name1 + "你赢了");
                            ying = ying+1;
                        }
                        else
                        {
                            Console.WriteLine(name1 + "你输了");
                            shu = shu + 1;
                        }
                        ci = ci + 1;

                    }
                    else if (key2 == 2)
                    {
                        Console.WriteLine(name1 + ":" + "出拳：" + f1);
                        ListFist();
                        Liubei liu = new Liubei(name);
                        Random ra = new Random();
                        int a = ra.Next(3) + 1;
                        Fist fist = (Fist)a;
                        Console.WriteLine(name+"：出拳：" + fist);
                        if (a == 1)
                        {
                            Console.WriteLine(name1 + "你输了");
                            shu = shu + 1;
                        }
                        else if (a == 2)
                        {
                            Console.WriteLine("平局");
                            ping = ping + 1;
                        }
                        else
                        {
                            Console.WriteLine(name1 + "你赢了");
                            ying = ying + 1;
                        }
                        ci = ci + 1;
                    }
                    else if (key2 == 3)
                    {
                        Console.WriteLine(name + ":" + "出拳：" + f2);
                        ListFist();
                        Liubei liu = new Liubei(name);
                        Random ra = new Random();
                        int a = ra.Next(3) + 1;
                        Fist fist = (Fist)a;
                        Console.WriteLine(name1+"：出拳：" + fist);
                        if (a == 1)
                        {
                            Console.WriteLine(name1 + "你赢了");
                            ying = ying + 1;
                        }
                        else if (a == 2)
                        {
                            Console.WriteLine(name1 + "你输了");
                            shu = shu + 1;
                        }
                        else
                        {
                            Console.WriteLine("平局");
                            ping = ping + 1;
                        }
                        ci = ci + 1;
                    }
                    else
                    {
                        Console.WriteLine("输入错误");

                    }
                    Console.WriteLine("是否进行下一轮");
                    Console.WriteLine("请选择1、是 2否");
                    int key3 = int.Parse(Console.ReadLine());
                    switch (key3)
                    {
                        case 1:
                            Console.WriteLine("请选择1、开始游戏 2、返回上一级");
                            Panduan();
                            break;
                        case 2:
                            jieguo();
                            break;
                        default:
                            break;
                    }
                    break;
                case 2:
                    Console.WriteLine("退出成功!");
                    break;
                default:
                    break;
            }
        }

        public static string ListFist()
        {
            string FistString = "";
            int i = 1;
            foreach (Fist item in Enum.GetValues(typeof(Fist)))
            {
                FistString += i + "、" + item + "；";
                i++;
            }
            return FistString;

        }
        public static void jieguo()
        {
            Console.WriteLine("**********************************************");
            Console.WriteLine(name+"vs"+name1);
            Console.WriteLine("共对局"+ci);
            Console.WriteLine("平局"+ping);
            Console.WriteLine(name1+"得分"+ying);
            Console.WriteLine(name + "得分" + shu);
            if (ying>shu)
            {
                Console.WriteLine("笨蛋"+name+"你输了");
            }
            else
            {
                Console.WriteLine("笨蛋" + name1+ "你输了");
            }
            Console.WriteLine("是否进行下一局");
            Console.WriteLine("请选择1、是 2否");
            ping = 0;
            ying = 0;
            shu = 0;
            ci = 0;
            
            int key= int.Parse(Console.ReadLine());
            switch (key)
            {
                case 1:
                    kaishi();
                    break;
                case 2:
                    Console.WriteLine("拜拜哦");
                    break;
                default:
                    break;
            }
        }
    }
 }
    

